cmake_minimum_required(VERSION 3.16)
project(Ferghana LANGUAGES CXX)

include(qt.cmake)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR}
    COMPONENTS
        Core
        Gui
        Widgets
)
find_package(Qt6 REQUIRED COMPONENTS OpenGL OpenGLWidgets)

qt_standard_project_setup()

set(PROJECT_SOURCES
    main.cpp
    Ferghana.ui
    Ferghana.h
    Ferghana.cpp
    FerghanaScreen.h
    FerghanaScreen.cpp
)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/Library)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/Library)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/Runtime)

include_directories(${SOLUTION_DIR}/Dragon)


qt_add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})

set_target_properties(${PROJECT_NAME}
    PROPERTIES
        WIN32_EXECUTABLE TRUE
)
link_directories(${SOLUTION_DIR}/Library)

target_link_libraries(${PROJECT_NAME} PUBLIC Qt::Core Qt::Gui Qt::Widgets) 
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::OpenGL Qt6::OpenGLWidgets)
target_link_libraries(${PROJECT_NAME} PRIVATE Dragon)